int pot=A0; //Analog 0 pin named as sensor int led=11; //Pin-11 is declared as output led void setup() { pinMode(led, OUTPUT); //Pin-11 is declared as output //We dont need to declare the A0 pin as input since it is predefined as input } void loop() { int reading=analogRead(pot); //Reading the voltage out by potentiometer int bright=reading/4; //Dividing reading by 4 to bring it in range of 0 - 255 since 1042 form pot need to by 256 for led to work delay(10); //Delay is not necessary you can remove it analogWrite(pot, bright); //Finally outputting the read value on pin-9 fading led }